// 过滤出路由
// 后台返回的权限路由跟路由表进行对比匹配,返回一个过滤好的路由：userRouter，allRouter，finalRouter

export function recursionRouter(userRouter = [], allRouter = []) {
	let finalRouter = allRouter.filter(item => userRouter.includes(item.name)).map(item => ({
		...item,
		children: item.children ?
			recursionRouter(userRouter, item.children) :
			null
	}));
	return finalRouter;
}
